package com.examplemartin.jpademo.pojo.po.repository.purchase;

import com.examplemartin.jpademo.annotation.EntityCheck;
import com.examplemartin.jpademo.pojo.admin.BaseEntity;
import com.examplemartin.jpademo.pojo.po.UserPO;
import com.examplemartin.jpademo.pojo.po.purchase.PurPO;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 采购入库单实体
 */

@Data
@EqualsAndHashCode(callSuper = true)
@Entity(name = "t_purin")
public class PurInPO extends BaseEntity implements Serializable,Cloneable {

  // 采购订单 one
  @ManyToOne
  private PurPO purPO;

  // 仓管员 one
  @ManyToOne
  private UserPO userPO;

  // 采购入库单明细 list
//  @OrderColumn
  @OneToMany(mappedBy = "purInPO")
//  @JsonIgnore
  private List<PurInDetailPO> purInDetailPOList;


  // 订单好
  @EntityCheck(required = true, errRequired = "必须输入库单号")
  private String name;

  // 到货日期
  private Date need;

  // 入库但状态
  private Integer status;

  @Override
  public Object clone() throws CloneNotSupportedException {
    return super.clone();
  }

  @Override
  public String toString() {
    return "PurInPO{" +
        "purPO=" + purPO +
        ", userPO=" + userPO +
        ", name='" + name + '\'' +
        ", need=" + need +
        ", status=" + status +
        '}';
  }
}
